//
//  SearchCell.m
//  7.13苏宁框架
//
//  Created by app01 on 15/7/21.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "SearchCell.h"
#import "TopicCellModel.h"


@implementation SearchCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    return [[NSBundle mainBundle]loadNibNamed:@"SearchCell" owner:self options:nil][0];
}


-(void)awakeFromNib{
    
    _btn.layer.borderWidth = 1;
    _btn.layer.borderColor = [UIColor orangeColor].CGColor;
    _btn.layer.cornerRadius = 5;
    _btn.layer.masksToBounds = YES;
    
}
-(void)layoutSubviews{
    
    
//    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
//    BOOL flag=[defaults boolForKey:@"iselected"];
    
    _label.text = _model.title;
    
    if (self.model.iscare) {
        [_btn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
        _btn.layer.borderColor = [UIColor lightGrayColor].CGColor;
    }else{
        [_btn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
        _btn.layer.borderColor = [UIColor orangeColor].CGColor;
    }
    
}

- (IBAction)careAction:(id)sender {
    if ([self.delegate respondsToSelector:@selector(clickCareBtn:model:)]) {
        [self.delegate clickCareBtn:sender model:_model];
    }
}
@end
